#ifndef EVENT_H_

#define EVENT_H_

#include "common.h"
#include "object.h"

class EventHandler;

class Event : public Object{
	public:
		enum EVENT_TYPE{
			TIMER = 0,
			RECV_PACK,
			NODE_JOIN,
			NODE_DEPARTURE,
			SEARCH,
			COMMAND

		};
		Event( EVENT_TYPE type, EventHandler *h ) : Object(), time_(-1.0), type_(type), handler_(h) {}
		virtual ~Event() {}


		sim_time_t getTime( void ) const {return time_;}
		void       setTime( sim_time_t t ) {time_=t;}
		EVENT_TYPE getType( void ) const {return type_;}
		EventHandler *getHandler( void ) {return handler_;}

		bool operator >( Event& other ){
			return ( this->time_ > other.time_ );
		}

	private:
		sim_time_t time_;//time when the event occurs
		EVENT_TYPE type_;
		EventHandler *handler_;
};

#endif /* EVENT_H_ */

